#ifndef TCPSERVER_H_
#define TCPSERVER_H_

#include "../databaseADT/databaseADT.h"

typedef struct sockyID
{
    int fdsock;
    int cliID;
}sockyID;

void endCiclesTCP(int signo);
void closeALLTCP(void);
void sighandLCTCP(int signo);

int waitPckTCP (int newsockfd, char * msg, int sonid);

int mainTCP (void);
void * listenPubTCP (void * paramsTCP);

void readCommandsTCP(void);

void salirTCP(char * param);

int addnameTCP (char * name, int newsockfd, int id);
void adddirTCP (char * dir, int newsockfd, int sonid);
void removedirTCP (char * dir, int newsockfd);
void listdirsTCP (int newsockfd);
void closesessTCP (int newsockfd);

int getparamsTCP (char * full, char * params);
int sndlistTCP (int newsockfd);

void rcvCommitTCP (char * dir, int newsockfd);
int srv_commitTCP (int newsockfd, char * path, int type);

int canCommittTCP(char * msg, int fd);

void catcher(int sig, int newsockfd);
void * listenQueueTCP(void * paramsTCP);
void * listenPrivTCP (void * paramsTCP);

int listenQueueSonTCP(int newsockfd, int type);
int forwardTCP (char * name, char * path, int type);

#endif /*TCPSERVER_H_*/
